package cn.hh.god;

import cn.hh.course.domain.Course;
import cn.hh.god.domain.Buy;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class BuyFallBack implements FallbackFactory<IBuyClient> {

    @Override
    public IBuyClient create(Throwable throwable) {
        return new IBuyClient() {
            @Override
            public Course getById(Long id) {
                return new Course("网络异常，请稍后重试");
            }

            @Override
            public void updateById(Buy buy) {
                /*try {
                    Thread.sleep(10000L);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }*/

            }
        };
    }
}
